﻿using System.Collections.Generic;
using JLL.China.Infrastructure.Repositories;
using JLL.China.Infrastructure.Repositories.ListingFloorPlan;
using JLL.China.Infrastructure.RepositoryFramework;
namespace JLL.China.Infrastructure.Services
{
    public static class ListingFloorPlanService
    { private static ListingFloorPlanRepository repository;
    static ListingFloorPlanService()
        {
            repository = RepositoryFactory.GetRepository<ListingFloorPlanRepository, Model.ListingFloorPlan, int>(new LINQ2SQLUnitOfWork<int>());
        }
        public static int Deleted(decimal? id)
        {
            return repository.Deleted(id);
        }
        public static decimal Create(Model.ListingFloorPlan prj, Model.ListingFloorPlan prjLocal)
        {
            prj.LanguageFID = 1;
            decimal id = repository.Create(prj);
            prjLocal.LanguageFID = 2;
            prjLocal.NoUnit = prj.NoUnit;
            prjLocal.ListingFID = prj.ListingFID;
            prjLocal.FloorPlanImg = prj.FloorPlanImg;
            prjLocal.ListingFloorPlan_ID = id;
            return repository.Create(prjLocal);
        }

        public static decimal Update(Model.ListingFloorPlan prj, Model.ListingFloorPlan prjLocal)
        {
            prj.LanguageFID = 1;
            prjLocal.LanguageFID = 2;
            prjLocal.NoUnit = prj.NoUnit;
            prjLocal.ListingFID = prj.ListingFID;
            prjLocal.FloorPlanImg = prj.FloorPlanImg;
            prjLocal.ListingFloorPlan_ID = prj.ListingFloorPlan_ID;
            repository.Update(prj);
            return repository.Update(prjLocal);
        }

        public static IList<Model.ListingFloorPlan> FindByListingID_Language(decimal? listingid,decimal languagefid)
        {
            var result= repository.FindByListingID_Language(listingid, languagefid);
            return result;
        }

        public static Model.ListingFloorPlan FindByID_Language(decimal? ID, decimal languageFID)
        {
            var result = repository.FindByID_Language(ID, languageFID);
            return result;
        }
    }
}
